<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>XMLHttpRequest</title>
<style type="text/css">
	#loadingMassageContainer {
		width: 100%;
		height: 100%;
		position: absolute;
		left: 0px;
		top: 0px;
		text-align: center;
		background-color: #DDD;
	}
</style>
<script type="text/javascript">
	var HTTPCtrl = {
			getHTTP: function(){
				var xmlhttp = null;
				if (window.XMLHttpRequest) {
					xmlhttp = new XMLHttpRequest();
				} else {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				
				return xmlhttp;
			}
	};
	var request = HTTPCtrl.getHTTP();
	request.open('GET', '12-4.jsp', true);
	request.onreadystatechange = function(){
		var divElem = document.getElementById('loadingMassageContainer');
		if (request.readyState === 4) {
			divElem.style.display = 'none';
			var msg = request.responseText;
			alert('서버로부터 전송받은 메시지: ' + msg);
		} else {
			divElem.style.display = '';
		}
	};
	
	request.send()
</script>
</head>
<body>
XMLHttpRequest 학습을 위한 페이지입니다.
<div id="loadingMassageContainer">
	로딩중입니다...
</div>
</body>
</html>
